<!--
 * @Author: leo
 * @Date: 2024-09-29 14:27:19
 * @LastEditors: leo
 * @Description:
-->
<template>
  <div class="guide-container" v-if="!finished" v-loading="loading">
    <BoatWithFish />
    <div class="guide-content" @animationend="handleAnimationEnd">
      <h1 class="guide-title">欢迎来到MEM</h1>
      <p class="guide-description">点击下面的按钮开始探索！</p>
      <button class="start-button" @click="finishGuide">开始</button>
    </div>
  </div>
</template>

<script setup>
import { useRoute, useRouter } from 'vue-router'
import { useStore } from 'vuex'
import { computed } from 'vue'
import BoatWithFish from './AnimationBoard/BoatWithFish.vue'

const route = useRoute()
const router = useRouter()

const store = useStore()

const loading = computed(() => {
  return store.state.app.loading
})

const finishGuide = () => {
  console.log(store)
  store.dispatch('globalData/getMenuData')
  store.commit('changeLoading', true)
  setTimeout(() => {
    store.commit('changeLoading', false)
    router.push('/about')
  }, 500)
}
</script>

<style scoped>
.guide-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background-color: #007bff;
  color: white;
  animation: fadeIn 1s ease-in;
}

.guide-title {
  font-size: 2.5em;
  margin-bottom: 0.5em;
  animation: slideIn 0.5s ease-in-out;
}

.guide-description {
  font-size: 1.2em;
  margin-bottom: 1.5em;
}

.start-button {
  background-color: white;
  color: #007bff;
  border: none;
  border-radius: 5px;
  padding: 0.5em 1.5em;
  font-size: 1em;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.start-button:hover {
  background-color: #e7e7e7;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
</style>
